package com.sun.stringescapeutils;

import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;

import java.io.IOException;

public class OkHttpGetTest {

    OkHttpClient client = new OkHttpClient();

    String run(String url) throws IOException{
        Request request = new Request.Builder()
                .url(url)
                .build();
        try(Response response = client.newCall(request).execute()){
            return response.body().string();
        }
    }

    public static void main(String[] args) {

       OkHttpGetTest okHttpGetTest = new OkHttpGetTest();
        try {
            String result = okHttpGetTest.run("http://localhost:8888/tags/hot");
            System.out.println(result);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
